		<script language="JavaScript" src="js/checkbox.js" 
		type="text/JavaScript"></script> 
		<div id="content">
			<div class="c1">
				<div class="controls">
					<?php include('topnav.php'); ?>
					<?php include(APPPATH.'/views/profile_box.php'); ?>

				</div>
				<div class="tabs">
        <?php include(APPPATH.'/views/noticeMsg.php') ?>
					<div id="tab-1" class="tab">
						<article>
							<div class="text-section">
								<h1>用户列表</h1>
								<p>管理系统用户</p>	
							</div>
							<br>
							
								
							
								<form action="" method="post">
                <div class="threebutton">
                <?php
                if (@in_array("添加用户",$userAuth))
                {
	                echo '<div class="large button orange" onclick="haha()">新增用户</div>';
                }
								if (@in_array("删除用户",$userAuth))
								{
									echo '<input class="large button orange" type="submit" value="删除用户" name="delete">';
								}
								?>
                <div class="large button orange" onclick="haha1()">查询用户</div>
								
								</div>
							<br>
							<?php

								echo '<table class="admintable" width="100%">';
								echo '<tr align="left"><th class="adminth">全选<th class="adminth">用户组名<th class="adminth">用户ID<th class="adminth">姓名<th class="adminth">性别<th class="adminth">职称<th class="adminth">职务<th class="adminth">工号<th class="adminth">现所在系<th class="adminth">办公电话<th class="adminth">移动电话<th class="adminth">出生日期<th class="adminth">电子邮箱';
								if(isset($res))
								{
									foreach($res->result() as $row)
									{
										echo '<tr><td class="admincls0"><input type="checkbox" name="check[]" value="'.$row->User_ID.'"/>';
										
										//foreach($row as $k=>$val)
										//{
											//echo '<td class="admincls0">'.$val;
										//}
										echo '<td class="admincls0">'.$row->Group_Name;
										echo '<td class="admincls0">'.$row->User_ID;
										echo '<td class="admincls0">'.$row->Name;
										echo '<td class="admincls0">'.$row->Sex;
										echo '<td class="admincls0">'.$row->Title;
										echo '<td class="admincls0">'.$row->Duty;
										echo '<td class="admincls0">'.$row->JobNo;
										$query = $this->db->query("select Faculty from faculty where Faculty_ID = '".$row->Faculty_ID."'");
										echo '<td class="admincls0">'.$query->row()->Faculty;
										echo '<td class="admincls0">'.$row->FixTel;
										echo '<td class="admincls0">'.$row->Mobile;
										echo '<td class="admincls0">'.$row->Birth;
										echo '<td class="admincls0">'.$row->Email;				
									}
								}
								else
								{
								$sql = "select * from user";
								$res = $this->db->query($sql);
								foreach($res->result() as $row)
								{
									echo '<tr><td class="admincls0"><input type="checkbox" name="check[]" value="'.$row->User_ID.'"/>';
									
									//foreach($row as $k=>$val)
									//{
										//echo '<td class="admincls0">'.$val;
									//}
									echo '<td class="admincls0">'.$row->Group_Name;
									echo '<td class="admincls0">'.$row->User_ID;
									echo '<td class="admincls0">'.$row->Name;
									echo '<td class="admincls0">'.$row->Sex;
									echo '<td class="admincls0">'.$row->Title;
									echo '<td class="admincls0">'.$row->Duty;
									echo '<td class="admincls0">'.$row->JobNo;
									$query = $this->db->query("select Faculty from faculty where Faculty_ID = '".$row->Faculty_ID."'");
									echo '<td class="admincls0">'.$query->row()->Faculty;
									echo '<td class="admincls0">'.$row->FixTel;
									echo '<td class="admincls0">'.$row->Mobile;
									echo '<td class="admincls0">'.$row->Birth;
									echo '<td class="admincls0">'.$row->Email;				
								}
								}
								echo '</table>'
							?>
							</form>
						</article>
					</div>
				</div>
			</div>
		</div>




<form style="display:none" id="user" action="/phpdb/index.php/user/userlist" method="post">
<table>
	<tr>
		<td>User_ID(*):
		<td><input name="User_ID" type="text" />
	<tr>
		<td>Password(*):
		<td><input name="Password" type="text" />
	<tr>
		<td>Group_Name(*):
		<td><select name="Group_Name" />
		<?php
			$query = 
			$this->db->query("select Group_Name from usergroup");
			if ($query->num_rows() > 0)
			{ 
				foreach ($query->result() as $row) 
				{ 	
					echo '<option value='.$row->Group_Name.'>'.$row->Group_Name.'</option>';
				}
			}
		?>
		</select>
	<tr>
		<td>Name(*):
		<td><input name="Name" type="text" />
	<tr>
		<td>First_Name:
		<td><input name="First_Name" type="text" />
	<tr>
		<td>Last_Name:
		<td><input name="Last_Name" type="text" />
	<tr>
		<td>Sex:
		<td><input name="Sex" type="text" />
	<tr>
		<td>Faculty_ID:
		<td><select  name="Faculty_ID"  />
		<?php
			$query = 
			$this->db->query("select Faculty from faculty");
			if ($query->num_rows() > 0)
			{ 
				foreach ($query->result() as $row) 
				{ 	
					echo '<option value='.$row->Faculty.'>'.$row->Faculty.'</option>';
				}
			}
		?>
		</select>  
	<tr>
		<td>Faculty_Before_ID:
		<td><select  name="Faculty_Before_ID"  />
		<?php
			$query = 
			$this->db->query("select Faculty from faculty");
			if ($query->num_rows() > 0)
			{ foreach ($query->result() as $row) 
				{ 	
					echo '<option value='.$row->Faculty.'>'.$row->Faculty.'</option>';
				}
			}
		?>
			 </select>
	<tr>
		<td>Title:
		<td><input name="Title" type="text" />
	<tr>
		<td>Duty:
		<td><input name="Duty" type="text" />
	<tr>
		<td>JobNo:
		<td><input name="JobNo" type="text" />
	<tr>
		<td>FixTel:
		<td><input name="FixTel" type="text" />
	<tr>
		<td>Mobile:
		<td><input name="Mobile" type="text" />
	<tr>
		<td>Birth:
		<td><input name="Birth" type="text" />
	<tr>
		<td>Email:
		<td><input name="Email" type="text" />
	<tr>
		<td>Remark:
		<td><input name="Remark" type="text" />
	<tr>
		<td>PhotoLink:
		<td><input name="PhotoLink" type="text" />
	<tr>
		<td>
		<td><input name="insert" type="submit" />

</table>
</form>


<form style="display:none" id="user1" action="/phpdb/index.php/user/userlist" method="post">
<table>
	<tr>
		<td>User_ID:
		<td><input name="User_ID" type="text" />
	<tr>
		<td>Group_Name(*):
		<td><select name="Group_Name"  />
		<option value="0" />
		<?php
			$query = 
			$this->db->query("select Group_Name from usergroup");
			if ($query->num_rows() > 0)
			{ 
				foreach ($query->result() as $row) 
				{ 	
					echo '<option value='.$row->Group_Name.'>'.$row->Group_Name.'</option>';
				}
			}
		?>
		</select>
	<tr>
		<td>Name(*):
		<td><input name="Name" type="text" />
	<tr>
		<td>First_Name:
		<td><input name="First_Name" type="text" />
	<tr>
		<td>Last_Name:
		<td><input name="Last_Name" type="text" />
	<tr>
		<td>Sex:
		<td><input name="Sex" type="text" />
	<tr>
		<td>Faculty_ID:
		<td><select  name="Faculty_ID"  />
		<option value="0" />
		<?php
			$query = 
			$this->db->query("select Faculty from faculty");
			if ($query->num_rows() > 0)
			{ 
				foreach ($query->result() as $row) 
				{ 	
					echo '<option value='.$row->Faculty.'>'.$row->Faculty.'</option>';
				}
			}
		?>
		</select>  
	<tr>
		<td>Faculty_Before_ID:
		<td><select  name="Faculty_Before_ID"  />
		<option value="0" />
		<?php
			$query = 
			$this->db->query("select Faculty from faculty");
			if ($query->num_rows() > 0)
			{ foreach ($query->result() as $row) 
				{ 	
					echo '<option value='.$row->Faculty.'>'.$row->Faculty.'</option>';
				}
			}
		?>
			 </select>
	<tr>
		<td>Title:
		<td><input name="Title" type="text" />
	<tr>
		<td>Duty:
		<td><input name="Duty" type="text" />
	<tr>
		<td>JobNo:
		<td><input name="JobNo" type="text" />
	<tr>
		<td>FixTel:
		<td><input name="FixTel" type="text" />
	<tr>
		<td>Mobile:
		<td><input name="Mobile" type="text" />
	<tr>
		<td>Birth:
		<td><input name="Birth" type="text" />
	<tr>
		<td>Email:
		<td><input name="Email" type="text" />
	<tr>
		<td>Remark:
		<td><input name="Remark" type="text" />
	<tr>
		<td>PhotoLink:
		<td><input name="PhotoLink" type="text" />
	<tr>
		<td>
		<td><input name="query" type="submit" />

</table>
</form>



    <script>
	    function haha()
	    {
		    art.dialog({
				title:'新建',
		    	lock: true,
		    	background: '#fff', // 背景色
		    	opacity: 0.87,	// 透明度
			   content: document.getElementById('user'),
			   id: 'EF893L'
			});
	    }
		function haha1()
	    {
		    art.dialog({
				title: '查询',
		    	lock: true,
		    	background: '#fff', // 背景色
		    	opacity: 0.87,	// 透明度
			   content: document.getElementById('user1'),
			   id: 'EF893L'
			});
	    }
    </script>
</script>